home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / TECHNICA / AUTOCAD / 3266.ZIP / POP10.EXE / SETUP.LSP < prev   
Text File  |  1991-08-20  |  3KB  |  98 lines

  1. ;
  2. ;+-------------------------------------------------------------------------+
  3. ;| SETUP.LSP                                                               |
  4. ;| Ver.  1.0  Feb. 25, 1986                                                |
  5. ;|                                                                         |
  6. ;| J.J.K.     Feb. 25, 1986                                                |
  7. ;|                                                                         |
  8. ;| C.L.H      Nov. 29, 1987   Added error routine and input checking.      |
  9. ;|                                                                         |
  10. ;| M.D.F.     Jul.  2, 1990   Modified for use with the pop10 menus.       |
  11. ;|                                                                         |
  12. ;| This program will set the Units and Limits of a new drawing, and will   |
  13. ;| draw a border line around the drawing.                                  |
  14. ;+-------------------------------------------------------------------------+
  15. ;
  16. ;
  17. (vmon)
  18. (defun seterr (s)                     ;define an error handler
  19.  (if (/= s "Function cancelled")
  20.      (princ (strcat "\nError: " s))
  21.  )
  22.  (menucmd "P10=P10S")
  23.  (setvar "cmdecho" oce)               ;restore previous cmdecho value
  24.  (setvar "lunits" olu)                ;restore previous linear units value
  25.  (setq *error* oer                    ;restore previous error handler
  26.        seterr  nil )
  27.  (princ)
  28. )
  29.  
  30. (apply '(lambda (/ a b d cx cy xl yl oer olu oce)
  31.  (menucmd "P10=*")
  32.  (setq oce (getvar "cmdecho"))        ;store current cmdecho value
  33.  (setvar "cmdecho" 0)                 ;turn cmdecho off
  34.  (setq oer *error*                  ;store AutoLisp error routine
  35.        *error*  seterr)               ;temporarily replace it
  36.  (initget (+ 1 2 4))                  ;no null input, negative or zero values
  37.  (setq a (getint "\nSelect the Units from the screen menu: "))
  38.  (menucmd (strcat "P10=P10U" (itoa a)))
  39.  (menucmd "P10=*")
  40.  (cond
  41.    ((= a 5)
  42.     (setq a 2 d 5)
  43.    )
  44.  )
  45.  (setq olu (getvar "lunits"))         ;store current linear units setting
  46.  (command ".setvar" "lunits" a)        ;set linear units to new value
  47.  
  48.  (initget (+ 1 4))                    ;0 ok, but no null or negative values
  49.  (setq b (getreal "\nSelect the Scale from the screen menu: "))
  50.  (cond
  51.    (
  52.      (= b 0)
  53.      (progn
  54.       (initget (+ 1 2 4))              
  55.       (setq b (getreal "\nEnter the scale: "))
  56.       (setq b (float b))
  57.      )
  58.    )
  59.  )
  60.  (cond
  61.    (
  62.      (= d 5)
  63.      (menucmd "P10=P10METRIC")
  64.      (menucmd "P10=*")
  65.    )
  66.    (T
  67.      (menucmd "P10=P10ENGLISH")
  68.      (menucmd "P10=*")
  69.    )
  70.  )
  71.  (initget (+ 1 4))
  72.  (setq cx (getdist "\nSelect the Paper size from the screen menu: "))
  73.  (initget (+ 1 4))
  74.  (setq cy (getdist))
  75.  (cond
  76.    (
  77.      (= cx 0)
  78.       (initget (+ 1 2 4))
  79.       (setq cx (getdist "\nEnter the Horizontal Dimension of the paper: "))
  80.       (initget (+ 1 2 4))
  81.       (setq cy (getdist "\nEnter the Vertical Dimension of the paper: "))
  82.      )
  83.  )
  84.  (setq xl (* b cx) yl (* b cy))
  85.  (command ".limits" "0,0" (list xl yl)
  86.           ".insert" "border" "0,0" xl yl "0"
  87.           ".zoom" "a"
  88.  )
  89.  (menucmd "P10=P10S")
  90.  (menucmd "P10=*")
  91.  (setvar "cmdecho" oce)               ;restore previous value for cmdecho
  92.  (setq *error* oer                    ;restore previous error handler
  93.        seterr  nil )
  94.  (princ)
  95. )
  96. '()
  97. )
  98.